//package com.yf.exam.modules.trainingarchives.pdfexport.controller;
//
//import com.google.common.collect.Lists;
//import com.google.common.collect.Maps;
//import com.itextpdf.text.*;
//import com.itextpdf.text.pdf.*;
//import com.yf.exam.core.api.dto.BaseIdReqDTO;
//import com.yf.exam.modules.trainingarchives.headteacherlog.service.IHeadTeacherLogService;
//import com.yf.exam.modules.trainingarchives.pdfexport.dto.second.*;
//import com.yf.exam.modules.trainingarchives.pdfexport.dto.second.three.HeadTeacherLogListExportDTO;
//import com.yf.exam.modules.trainingarchives.pdfexport.dto.second.three.StudentInfoListExportDTO;
//import com.yf.exam.modules.trainingarchives.pdfexport.dto.second.three.TrainingClassScheduleListExportDTO;
//import com.yf.exam.modules.trainingarchives.studentinfo.service.IStudentInfoService;
//import com.yf.exam.modules.trainingarchives.teacherplanexecution.service.ITeachingPlanExecutionService;
//import com.yf.exam.modules.trainingarchives.trainingassessmentreport.service.ITrainingAssessmentReportService;
//import com.yf.exam.modules.trainingarchives.trainingclassinfo.entity.TrainingClassInfo;
//import com.yf.exam.modules.trainingarchives.trainingclassinfo.service.ITrainingClassInfoService;
//import com.yf.exam.modules.trainingarchives.trainingclassschedule.service.ITrainingClassScheduleService;
//import io.swagger.annotations.ApiModelProperty;
//import org.springframework.util.CollectionUtils;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//import java.io.File;
//import java.io.FileNotFoundException;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.time.LocalDateTime;
//import java.time.format.DateTimeFormatter;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
///**
// * pdf导出控制器
// *
// */
//@RestController
//@RequestMapping("/pdf")
//public class PdfExportController {
//
//    @Resource
//    private ITrainingClassScheduleService iTrainingClassScheduleService;
//
//    @Resource
//    private ITrainingClassInfoService iTrainingClassInfoService;
//
//    @Resource
//    private IStudentInfoService iStudentInfoService;
//
//    @Resource
//    private IHeadTeacherLogService iHeadTeacherLogService;
//
//    @Resource
//    private ITeachingPlanExecutionService iTeachingPlanExecutionService;
//
//    @Resource
//    private ITrainingAssessmentReportService iTrainingAssessmentReportService;
//
//
//
//    @RequestMapping(value = "/test/training",method = {RequestMethod.POST})
//    public void test1(@RequestBody BaseIdReqDTO reqDTO) throws Exception{
//        try {
//            long startTime = System.currentTimeMillis();
//            String trainingClassInfoId = reqDTO.getId();
//
//            // 模板路径
////            String macTemplatePath = "/Users/gengjiaxuan/Downloads/档案_部分2.pdf";
//            // 输出文件路径
////            String macOutputPath = "/Users/gengjiaxuan/Downloads/tempPdfFile/filled_template.pdf";
//
//            // 模板路径
//            String winTemplatePath = "E:\\org\\拆分pdf\\04表单域.pdf";
//            String macTemplatePath = "/Users/workspace/机构管理文档/档案表单域终版.pdf";
//            // 输出文件路径
//            String macOutputPath = "/Users/gengjiaxuan/Downloads/tempPdfFile/导出档案.pdf";
//
////            // 模板路径
////            String winTemplatePath = "E:\\org\\04文本域.pdf";
////            // 输出文件路径
////            String winOutputPath = "E:\\org\\培训班课程安排表.pdf";
//            // 加载自定义字体（例如宋体）
////            BaseFont baseFont = BaseFont.createFont("E:\\org\\org-manage\\exam-api\\src\\main\\resources\\fonts\\extend\\simsun.ttc,0", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
////            Font font = new Font(baseFont, 12); // 设置字体和字号
//            // 读取模板
//            PdfReader reader = new PdfReader(macTemplatePath);
//            PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(macOutputPath));
//
//            // 获取表单字段
//            AcroFields form = stamper.getAcroFields();
////            form.setSubstitutionFonts(Lists.newArrayList(baseFont)); // 设定替换字体
//
//            //获取一期一档公用数据
//            TrainingClassInfo commonData = iTrainingClassInfoService.getById(trainingClassInfoId);
//            //获取培训班课程安排表数据
//            TrainingClassScheduleExportPdfDTO pxbkcapbData = iTrainingClassScheduleService.getPdfData(trainingClassInfoId);
//            //获取安全培训计划表数据
//            TrainingClassInfoExportDTO aqpxjhbData = iTrainingClassInfoService.getPdfData(trainingClassInfoId);
//            //获取学员基本信息汇总表
//            StudentInfoExportDTO studentPdfData = iStudentInfoService.getStudentPdfData(trainingClassInfoId);
//            //获取班主任工作日志表
//            TrainingClassInfoBzrExportDTO headTeacherLogData = iHeadTeacherLogService.getHeadTeacherLogData(trainingClassInfoId);
//            //获取教学计划执行表
//            List<TeachingPlanExportDTO> teachingPlanPdfData = iTeachingPlanExecutionService.getTeachingPlanPdfData(trainingClassInfoId);
//            //获取授课教师签到数据
////            getTeacherAttendancePdfData
//            //获取学员考核情况表数据
//            StudentAssessmentExportDTO studentExamPdfData = iStudentInfoService.getStudentExamPdfData(trainingClassInfoId);
//            //获取综合考评报告
//            TrainingAssessmentReportExportDTO trainingAssessmentReporPdfData = iTrainingAssessmentReportService.getTrainingAssessmentReporPdfData(trainingClassInfoId);
//
//            // 填充数据
//            fillCommonData(form, aqpxjhbData,pxbkcapbData,studentPdfData,headTeacherLogData,commonData,teachingPlanPdfData,studentExamPdfData,trainingAssessmentReporPdfData);
//            fillScheduleData(form, pxbkcapbData,stamper);
//            fillStudentData(form, studentPdfData);
//            fillLogData(form, headTeacherLogData);
//            fillTeachingPlanData(form, teachingPlanPdfData);
//
//            //教学计划执行表
//            //授课老师签到表
//            // 设置表单只读
//            stamper.setFormFlattening(true);
//            // 获取 PDF 内容并设置字体
//            PdfContentByte contentByte = stamper.getOverContent(14);  // 获取第一页内容
//
//            // 设置字体（同样使用自定义字体）
////            contentByte.setFontAndSize(baseFont, 12);
//
//            stamper.close();
//            reader.close();
//            long endTime = System.currentTimeMillis();
//            System.out.println("PDF 模板填充完成，耗时：" + (endTime - startTime) + " 毫秒");
//            System.out.println("PDF 模板填充完成！");
//
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//
//    }
//
//    /**
//     * 公共数据填充
//     * @param form
//     * @param aqpxjhbData
//     * @param pxbkcapbData
//     * @param studentPdfData
//     * @param headTeacherLogData
//     * @throws IOException
//     * @throws DocumentException
//     */
//    private void fillCommonData(AcroFields form,
//                                TrainingClassInfoExportDTO aqpxjhbData,
//                                TrainingClassScheduleExportPdfDTO pxbkcapbData,
//                                StudentInfoExportDTO studentPdfData,
//                                TrainingClassInfoBzrExportDTO headTeacherLogData,
//                                TrainingClassInfo commonData,
//                                List<TeachingPlanExportDTO> teachingPlanPdfData,
//                                StudentAssessmentExportDTO studentExamPdfData,
//                                TrainingAssessmentReportExportDTO trainingAssessmentReporPdfData) throws IOException, DocumentException {
//        Map<String, String> baseDataMap = Maps.newHashMap();
//        //构建安全培训计划
//        baseDataMap.put("aqpxjhOrganizationName", aqpxjhbData.getAqpxjhOrganizationName());
//        baseDataMap.put("aqpxjhAddress", aqpxjhbData.getAqpxjhAddress());
//        baseDataMap.put("aqpxjhClassName", aqpxjhbData.getAqpxjhClassName());
//        baseDataMap.put("aqpxjhTargetStudents", aqpxjhbData.getAqpxjhTargetStudents());
//        baseDataMap.put("aqpxjhPlannedNumber", String.valueOf(aqpxjhbData.getAqpxjhPlannedNumber()));
//        baseDataMap.put("aqpxjhTrainingMode", aqpxjhbData.getAqpxjhTrainingMode());
//        baseDataMap.put("aqpxjhTrainingType", aqpxjhbData.getAqpxjhTrainingType());
//        baseDataMap.put("aqpxjhTrainingDate", aqpxjhbData.getAqpxjhTrainingDate());
//        baseDataMap.put("aqpxjhTrainingLocation", aqpxjhbData.getAqpxjhTrainingLocation());
//        baseDataMap.put("aqpxjhHeadTeacherName", aqpxjhbData.getAqpxjhHeadTeacherName());
//        baseDataMap.put("aqpxjhHeadTeacherPhone", aqpxjhbData.getAqpxjhHeadTeacherPhone());
//        baseDataMap.put("aqpxjhHeadTeacherContact", aqpxjhbData.getAqpxjhHeadTeacherContact());
//        baseDataMap.put("aqpxjhHuditorOpinion", aqpxjhbData.getAqpxjhHuditorOpinion());
//        baseDataMap.put("aqpxjhAuditDate", aqpxjhbData.getAqpxjhAuditDate());
////        baseDataMap.put("aqpxjhAuditorSignature", aqpxjhbData.getAqpxjhAuditorSignature());
//        baseDataMap.put("aqpxjhApproverOpinion", aqpxjhbData.getAqpxjhApproverOpinion());
//        baseDataMap.put("aqpxjhApprovalDate", aqpxjhbData.getAqpxjhApprovalDate());
////        baseDataMap.put("aqpxjhApproverSignature", aqpxjhbData.getAqpxjhApproverSignature());
//        //培训班课程安排
//        baseDataMap.put("pxbkcapTrainingClassScheduleName", pxbkcapbData.getPxbkcapTrainingClassScheduleName());
//        //学员基本信息汇总
//        baseDataMap.put("xyjbxxhzTableName", studentPdfData.getXyjbxxhzClassName() + commonData.getTrainingStartDate() + " 至 " + commonData.getTrainingEndDate());
//        //班主任工作日志
//        baseDataMap.put("bzrgzrzjlClassName", headTeacherLogData.getBzrgzrzjlClassName());
//        baseDataMap.put("bzrgzrzjlOrganizationName", headTeacherLogData.getBzrgzrzjlOrganizationName());
//        // 将 LocalDateTime 转换为字符串（例如格式：yyyy-MM-dd HH:mm:ss）
////        baseDataMap.put("bzrgzrzjlTrainingStartDate", headTeacherLogData.getBzrgzrzjlTrainingStartDate() != null ?
////                headTeacherLogData.getBzrgzrzjlTrainingStartDate().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : "");
//        baseDataMap.put("bzrgzrzjlHeadTeacherName", headTeacherLogData.getBzrgzrzjlHeadTeacherName());
//        baseDataMap.put("bzrgzrzjlHeadTeacherGender", headTeacherLogData.getBzrgzrzjlHeadTeacherGender());
////        baseDataMap.put("bzrgzrzjlHeadTeacherPhoto", headTeacherLogData.getBzrgzrzjlHeadTeacherPhoto());
//        //教学计划实行表头
//        baseDataMap.put("jxjhzxbClassName", commonData.getClassName());
//        baseDataMap.put("jxjhzxbTrainingType", commonData.getTrainingType());
//        baseDataMap.put("jxjhzxbDate", commonData.getTrainingStartDate().toString());//TODO 需核对
//        // 学时总和
//        int totalHours = teachingPlanPdfData.stream()
//                .filter(dto -> dto.getJxjhzxbHours() != null && dto.getJxjhzxbHours().matches("\\d+")) // 过滤非数字的学时
//                .mapToInt(dto -> Integer.parseInt(dto.getJxjhzxbHours())) // 转换为整数
//                .sum();
//
//        // 去重后的课程名称数量
//        int courseNameCount = (int) teachingPlanPdfData.stream()
//                .filter(dto -> dto.getJxjhzxbCourseName() != null)
//                .map(TeachingPlanExportDTO::getJxjhzxbCourseName)
//                .distinct()
//                .count();
//
//        // 去重后的教师姓名数量
//        int teacherNameCount = (int) teachingPlanPdfData.stream()
//                .filter(dto -> dto.getJxjhzxbTeacherName() != null)
//                .map(TeachingPlanExportDTO::getJxjhzxbTeacherName)
//                .distinct()
//                .count();
//        baseDataMap.put("jxjhzxbHoursCount", String.valueOf(totalHours));
//        baseDataMap.put("jxjhzxbTeacherNameCount", String.valueOf(teacherNameCount));
//        baseDataMap.put("jxjhzxbCourseNameCount", String.valueOf(courseNameCount));
//        //TODO 实际操作教师
//        //TODO 符合规定学时
//
//        //学员考核情况表
//        if (studentExamPdfData != null) {
//            baseDataMap.put("xykhqkName", studentExamPdfData.getXykhqkName());
//            baseDataMap.put("xykhqkGender", studentExamPdfData.getXykhqkGender());
//            baseDataMap.put("xykhqkEthnicity", studentExamPdfData.getXykhqkEthnicity());
//            baseDataMap.put("xykhqkBirthplace", studentExamPdfData.getXykhqkBirthplace());
//            baseDataMap.put("xykhqkDob", studentExamPdfData.getXykhqkDob().toString());
//            baseDataMap.put("xykhqkPoliticalStatus", studentExamPdfData.getXykhqkPoliticalStatus());
//            baseDataMap.put("xykhqkIdCard", studentExamPdfData.getXykhqkIdCard());
//            baseDataMap.put("xykhqkPhone", studentExamPdfData.getXykhqkPhone());
//            baseDataMap.put("xykhqkGraduatingSchool", studentExamPdfData.getXykhqkGraduatingSchool());
//            baseDataMap.put("xykhqkEducation", studentExamPdfData.getXykhqkEducation());
//            baseDataMap.put("xykhqkClassName", studentExamPdfData.getXykhqkClassName());
//            baseDataMap.put("xykhqkTrainingStartDate", studentExamPdfData.getXykhqkTrainingStartDate().toString());
//            baseDataMap.put("xykhqkAttendanceScore", String.valueOf(studentExamPdfData.getXykhqkAttendanceScore()));
//            baseDataMap.put("xykhqkDisciplineScore", String.valueOf(studentExamPdfData.getXykhqkDisciplineScore()));
//            baseDataMap.put("xykhqkPerformanceScore", String.valueOf(studentExamPdfData.getXykhqkPerformanceScore()));
//            baseDataMap.put("xykhqkPracticalScore", String.valueOf(studentExamPdfData.getXykhqkPracticalScore()));
//            baseDataMap.put("xykhqkKnowledgeScore", String.valueOf(studentExamPdfData.getXykhqkKnowledgeScore()));
//        }
//
//
//        //综合考评报告
//        if (commonData != null && trainingAssessmentReporPdfData != null) {
//            baseDataMap.put("zhkpbgClassName", commonData.getClassName());
//            baseDataMap.put("zhkpbgIntro", trainingAssessmentReporPdfData.getZhkpbgIntro());
//            baseDataMap.put("zhkpbgSection1", trainingAssessmentReporPdfData.getZhkpbgSection1());
//            baseDataMap.put("zhkpbgSection2", trainingAssessmentReporPdfData.getZhkpbgSection2());
//            baseDataMap.put("zhkpbgSection3", trainingAssessmentReporPdfData.getZhkpbgSection3());
//            baseDataMap.put("zhkpbgSection4", trainingAssessmentReporPdfData.getZhkpbgSection4());
//            baseDataMap.put("zhkpbgSection5", trainingAssessmentReporPdfData.getZhkpbgSection5());
//        }
//
//        //填充其他公共数据
//        for (Map.Entry<String, String> entry : baseDataMap.entrySet()) {
//            form.setField(entry.getKey(), entry.getValue());
//        }
//    }
//
//    /**
//     * 填充课程安排数据
//     * @param form
//     * @param scheduleData
//     * @throws IOException
//     * @throws DocumentException
//     */
//    private void fillScheduleData(AcroFields form, TrainingClassScheduleExportPdfDTO scheduleData) throws IOException, DocumentException {
//        List<TrainingClassScheduleListExportDTO> list = scheduleData.getTrainingClassScheduleListExportDTOList();
//        if (!CollectionUtils.isEmpty(list)) {
//            for (int i = 0; i < list.size(); i++) {
//                TrainingClassScheduleListExportDTO item = list.get(i);
//                form.setField("pxbkcapNo" + (i + 1), item.getPxbkcapNo());
//                form.setField("pxbkcapTeacherName" + (i + 1), item.getPxbkcapTeacherName());
//                form.setField("pxbkcapEducation" + (i + 1), item.getPxbkcapEducation());
//                form.setField("pxbkcapMajor" + (i + 1), item.getPxbkcapMajor());
//                form.setField("pxbkcapTitle" + (i + 1), item.getPxbkcapTitle());
//                form.setField("pxbkcapCourse" + (i + 1), item.getPxbkcapCourse());
//                form.setField("pxbkcapHours" + (i + 1), String.valueOf(item.getPxbkcapHours()));
//                form.setField("pxbkcapQualificationNumber" + (i + 1), item.getPxbkcapQualificationNumber());
//            }
//        }
//    }
//
//
//    private void fillScheduleData(AcroFields form, TrainingClassScheduleExportPdfDTO scheduleData, PdfStamper stamper) throws IOException, DocumentException {
//        List<TrainingClassScheduleListExportDTO> list = scheduleData.getTrainingClassScheduleListExportDTOList();
//
//        if (!CollectionUtils.isEmpty(list)) {
//            // 创建 PdfContentByte 用于绘制表头和标题
//            PdfContentByte cb = stamper.getOverContent(1);
//
//            // 加载 BaseFont，选择一个字体文件（这里以 Helvetica 为例）
//            BaseFont titleBaseFont = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, false);
//            BaseFont headerBaseFont = BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.WINANSI, false);
//
//            // 设置表格标题字体
//            Font titleFont = new Font(titleBaseFont, 14, Font.BOLD);
//
//            // 设置表头字体
//            Font headerFont = new Font(headerBaseFont, 12, Font.BOLD);
//
//            // 绘制表格标题
//            float titleY = 840; // 标题的位置
//            cb.beginText();
//            cb.setFontAndSize(titleBaseFont, 14); // 设置字体和大小
//            cb.showTextAligned(Element.ALIGN_CENTER, "培训班课程安排表", 300, titleY, 0);  // 标题居中
//            cb.endText();
//
//            // 绘制表头
//            float startY = 800;  // 表头开始的位置
//            float rowHeight = 20; // 每行高度
//
//            cb.beginText();
//            cb.setFontAndSize(headerBaseFont, 12);  // 确保在开始写表头文本之前设置字体和大小
//
//            // 表头内容
//            cb.showTextAligned(Element.ALIGN_CENTER, "课程编号", 50 + 75 / 2, startY, 0);
//            cb.showTextAligned(Element.ALIGN_CENTER, "教师名称", 50 + 75 * 1 + 75 / 2, startY, 0);
//            cb.showTextAligned(Element.ALIGN_CENTER, "学历", 50 + 75 * 2 + 75 / 2, startY, 0);
//            cb.showTextAligned(Element.ALIGN_CENTER, "专业", 50 + 75 * 3 + 75 / 2, startY, 0);
//            cb.showTextAligned(Element.ALIGN_CENTER, "职称", 50 + 75 * 4 + 75 / 2, startY, 0);
//            cb.showTextAligned(Element.ALIGN_CENTER, "课程", 50 + 75 * 5 + 75 / 2, startY, 0);
//            cb.showTextAligned(Element.ALIGN_CENTER, "学时", 50 + 75 * 6 + 75 / 2, startY, 0);
//            cb.showTextAligned(Element.ALIGN_CENTER, "资格证书编号", 50 + 75 * 7 + 75 / 2, startY, 0);
//
//            cb.endText();
//
//            // 绘制表格边框
//            cb.setLineWidth(1);
//            cb.rectangle(50, startY - rowHeight, 75 * 8, rowHeight);  // 绘制表头边框
//            cb.stroke();
//
//            // 动态填充数据部分
//            for (int i = 0; i < list.size(); i++) {
//                TrainingClassScheduleListExportDTO item = list.get(i);
//
//                // 动态添加课程编号
//                PdfFormField fieldNo = PdfFormField.createTextField(stamper.getWriter(), false, false, 100);
//                fieldNo.setFieldName("pxbkcapNo" + (i + 1));
//                fieldNo.setValueAsString(String.valueOf(i + 1));
//                Rectangle rectNo = new Rectangle(50, startY - (i * rowHeight) - rowHeight, 50 + 75, startY - (i * rowHeight));
//                fieldNo.setWidget(rectNo, PdfAnnotation.HIGHLIGHT_NONE);
//                stamper.addAnnotation(fieldNo, 1);
//
//                // 动态添加教师名称
//                PdfFormField fieldTeacher = PdfFormField.createTextField(stamper.getWriter(), false, false, 100);
//                fieldTeacher.setFieldName("pxbkcapTeacherName" + (i + 1));
//                fieldTeacher.setValueAsString(item.getPxbkcapTeacherName());
//                Rectangle rectTeacher = new Rectangle(50 + 75, startY - (i * rowHeight) - rowHeight, 50 + 75 * 2, startY - (i * rowHeight));
//                fieldTeacher.setWidget(rectTeacher, PdfAnnotation.HIGHLIGHT_NONE);
//                stamper.addAnnotation(fieldTeacher, 1);
//
//                // 动态添加学历
//                PdfFormField fieldEducation = PdfFormField.createTextField(stamper.getWriter(), false, false, 100);
//                fieldEducation.setFieldName("pxbkcapEducation" + (i + 1));
//                fieldEducation.setValueAsString(item.getPxbkcapEducation());
//                Rectangle rectEducation = new Rectangle(50 + 75 * 2, startY - (i * rowHeight) - rowHeight, 50 + 75 * 3, startY - (i * rowHeight));
//                fieldEducation.setWidget(rectEducation, PdfAnnotation.HIGHLIGHT_NONE);
//                stamper.addAnnotation(fieldEducation, 1);
//
//                // 动态添加专业
//                PdfFormField fieldMajor = PdfFormField.createTextField(stamper.getWriter(), false, false, 100);
//                fieldMajor.setFieldName("pxbkcapMajor" + (i + 1));
//                fieldMajor.setValueAsString(item.getPxbkcapMajor());
//                Rectangle rectMajor = new Rectangle(50 + 75 * 3, startY - (i * rowHeight) - rowHeight, 50 + 75 * 4, startY - (i * rowHeight));
//                fieldMajor.setWidget(rectMajor, PdfAnnotation.HIGHLIGHT_NONE);
//                stamper.addAnnotation(fieldMajor, 1);
//
//                // 动态添加职称
//                PdfFormField fieldTitle = PdfFormField.createTextField(stamper.getWriter(), false, false, 100);
//                fieldTitle.setFieldName("pxbkcapTitle" + (i + 1));
//                fieldTitle.setValueAsString(item.getPxbkcapTitle());
//                Rectangle rectTitle = new Rectangle(50 + 75 * 4, startY - (i * rowHeight) - rowHeight, 50 + 75 * 5, startY - (i * rowHeight));
//                fieldTitle.setWidget(rectTitle, PdfAnnotation.HIGHLIGHT_NONE);
//                stamper.addAnnotation(fieldTitle, 1);
//
//                // 动态添加课程
//                PdfFormField fieldCourse = PdfFormField.createTextField(stamper.getWriter(), false, false, 100);
//                fieldCourse.setFieldName("pxbkcapCourse" + (i + 1));
//                fieldCourse.setValueAsString(item.getPxbkcapCourse());
//                Rectangle rectCourse = new Rectangle(50 + 75 * 5, startY - (i * rowHeight) - rowHeight, 50 + 75 * 6, startY - (i * rowHeight));
//                fieldCourse.setWidget(rectCourse, PdfAnnotation.HIGHLIGHT_NONE);
//                stamper.addAnnotation(fieldCourse, 1);
//
//                // 动态添加学时
//                PdfFormField fieldHours = PdfFormField.createTextField(stamper.getWriter(), false, false, 100);
//                fieldHours.setFieldName("pxbkcapHours" + (i + 1));
//                fieldHours.setValueAsString(String.valueOf(item.getPxbkcapHours()));
//                Rectangle rectHours = new Rectangle(50 + 75 * 6, startY - (i * rowHeight) - rowHeight, 50 + 75 * 7, startY - (i * rowHeight));
//                fieldHours.setWidget(rectHours, PdfAnnotation.HIGHLIGHT_NONE);
//                stamper.addAnnotation(fieldHours, 1);
//
//                // 动态添加资格证书编号
//                PdfFormField fieldQualification = PdfFormField.createTextField(stamper.getWriter(), false, false, 100);
//                fieldQualification.setFieldName("pxbkcapQualificationNumber" + (i + 1));
//                fieldQualification.setValueAsString(item.getPxbkcapQualificationNumber());
//                Rectangle rectQualification = new Rectangle(50 + 75 * 7, startY - (i * rowHeight) - rowHeight, 50 + 75 * 8, startY - (i * rowHeight));
//                fieldQualification.setWidget(rectQualification, PdfAnnotation.HIGHLIGHT_NONE);
//                stamper.addAnnotation(fieldQualification, 1);
//            }
//        }
//    }
//
//
//
//
//
//    /**
//     * 填充学员数据
//     * @param form
//     * @param studentData
//     * @throws IOException
//     * @throws DocumentException
//     */
//    private void fillStudentData(AcroFields form, StudentInfoExportDTO studentData) throws IOException, DocumentException {
//        List<StudentInfoListExportDTO> list = studentData.getStudentInfoListExportDTOList();
//        if (!CollectionUtils.isEmpty(list)) {
//            for (int i = 0; i < list.size(); i++) {
//                StudentInfoListExportDTO studentInfoListExportDTO = list.get(i);
//                form.setField("xyjbxxhzNo" + (i + 1), studentInfoListExportDTO.getXyjbxxhzNo());
//                form.setField("xyjbxxhzName" + (i + 1), studentInfoListExportDTO.getXyjbxxhzName());
//                form.setField("xyjbxxhzGender" + (i + 1), studentInfoListExportDTO.getXyjbxxhzGender());
//                form.setField("xyjbxxhzIdCard" + (i + 1), studentInfoListExportDTO.getXyjbxxhzIdCard());
//                form.setField("xyjbxxhzWorkplace" + (i + 1), studentInfoListExportDTO.getXyjbxxhzWorkplace());
//                form.setField("xyjbxxhzPosition" + (i + 1), studentInfoListExportDTO.getXyjbxxhzPosition());
//                form.setField("xyjbxxhzEducation" + (i + 1), studentInfoListExportDTO.getXyjbxxhzEducation());
//                form.setField("xyjbxxhzPhone" + (i + 1), studentInfoListExportDTO.getXyjbxxhzPhone());
//            }
//        }
//    }
//
//
//    /**
//     * 填充班主任日志记录数据
//     * @param form
//     * @param logData
//     * @throws IOException
//     * @throws DocumentException
//     */
//    private void fillLogData(AcroFields form, TrainingClassInfoBzrExportDTO logData) throws IOException, DocumentException {
//        List<HeadTeacherLogListExportDTO> teacherLogExportDTOList = logData.getTeacherLogExportDTOList();
////        if (!CollectionUtils.isEmpty(teacherLogExportDTOList)) {
////            for (int i = 0; i < teacherLogExportDTOList.size(); i++) {
////                HeadTeacherLogListExportDTO headTeacherLogListExportDTO = teacherLogExportDTOList.get(i);
////                form.setField("bzrgzrzjlYear" + (i + 1), headTeacherLogListExportDTO.getBzrgzrzjlYear());
////                form.setField("bzrgzrzjlMonth" + (i + 1), headTeacherLogListExportDTO.getBzrgzrzjlMonth());
////                form.setField("bzrgzrzjlDay" + (i + 1), headTeacherLogListExportDTO.getBzrgzrzjlDay());
////                form.setField("bzrgzrzjlWeather" + (i + 1), headTeacherLogListExportDTO.getBzrgzrzjlWeather());
////                form.setField("bzrgzrzjlLogContent" + (i + 1), headTeacherLogListExportDTO.getBzrgzrzjlLogContent());
////            }
////        }
//    }
//
//    /**
//     * 填充教学计划数据
//     * @param form
//     * @param teachingPlanData
//     * @throws IOException
//     * @throws DocumentException
//     */
//    private void fillTeachingPlanData(AcroFields form, List<TeachingPlanExportDTO> teachingPlanData) throws IOException, DocumentException {
//        if (!CollectionUtils.isEmpty(teachingPlanData)) {
//            for (int i = 0; i < teachingPlanData.size(); i++) {
//                TeachingPlanExportDTO teachingPlanExportDTO = teachingPlanData.get(i);
//                form.setField("jxjhzxbNo" + (i + 1), teachingPlanExportDTO.getJxjhzxbNo());
//                form.setField("jxjhzxbCourseName" + (i + 1), teachingPlanExportDTO.getJxjhzxbCourseName());
//                form.setField("jxjhzxbHours" + (i + 1), teachingPlanExportDTO.getJxjhzxbHours());
//                form.setField("jxjhzxbTextbook" + (i + 1), teachingPlanExportDTO.getJxjhzxbTextbook());
//                form.setField("jxjhzxbTeacherName" + (i + 1), teachingPlanExportDTO.getJxjhzxbTeacherName());
//                form.setField("jxjhzxbTeacherWorkplace" + (i + 1), teachingPlanExportDTO.getJxjhzxbTeacherWorkplace());
//                form.setField("jxjhzxbTeacherGraduatingSchool" + (i + 1), teachingPlanExportDTO.getJxjhzxbTeacherGraduatingSchool());
//                form.setField("jxjhzxbTeacherMajor" + (i + 1), teachingPlanExportDTO.getJxjhzxbTeacherMajor());
//                form.setField("jxjhzxbTeacherTeachingMajor" + (i + 1), teachingPlanExportDTO.getJxjhzxbTeacherTeachingMajor());
//                form.setField("jxjhzxbTeacherTitle" + (i + 1), teachingPlanExportDTO.getJxjhzxbTeacherTitle());
//                form.setField("jxjhzxbTeacherSignature" + (i + 1), teachingPlanExportDTO.getJxjhzxbTeacherSignature());
//            }
//        }
//    }
//
//}
